package city.spring.modules.reception.vo;

import city.spring.action.model.AbstractActiveOldman;
import city.spring.modules.reception.entity.OldmanActiveExtEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class OldmanActiveExtVO extends OldmanActiveExtEntity {
    /**
     * 老人姓名
     */
    private String oldmanName;

    /**
     * 手机号码
     */
    private String telephone;

    /**
     * 出生日期
     */
    private String birthday;

    /**
     * 转换成出库时所需要的对象
     */
    public AbstractActiveOldman<OldmanActiveExtVO> toActiveOldman() {
        OldmanActiveExtVO item = this;
        return new AbstractActiveOldman<OldmanActiveExtVO>() {

            @Override
            public Object getKey() {
                return item.getOldmanId();
            }

            @Override
            public String getOldmanName() {
                return item.getOldmanName();
            }

            @Override
            public String getTelephone() {
                return item.getTelephone();
            }

            @Override
            public String getBirthday() {
                return item.getBirthday();
            }

            @Override
            public OldmanActiveExtVO getObject() {
                return item;
            }
        };
    }
}
